package com.demo.modules.file.controller;

import com.demo.common.core.result.R;
import com.demo.modules.file.domain.sys.file.SysFileVo;
import com.demo.modules.file.service.ISysFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author MyPC
 */
@Api(tags = "A - 文件管理")
@RestController
@RequestMapping("/file")
public class SysFileController {

    @Autowired
    private ISysFileService sysFileService;

    @PostMapping("/upload")
    @ApiOperation("文件上传接口")
    public R<SysFileVo> upload(@RequestParam("file") MultipartFile file) {
        return R.ok(sysFileService.uploadFile(file));
    }
}
